package com.kws.system.controller.Payment;

import com.kws.common.core.domain.R;
import com.kws.system.domain.payment.rq.CreateRemitAccountRq;
import com.kws.system.domain.vo.CreateSeparateAccountRq;
import com.kws.system.service.payment.UnionPaySeparateAccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * <b>UnionPaySeparateAccountController</b>
 *
 * @description: UnionPaySeparateAccountController <br>
 * @date: 2024/12/20 11:04 <br>
 * @author: lhm <br>
 * @version: 1.0 <br>
 */

@Api(tags = "分账管理模块")
@RestController
public class UnionPaySeparateAccountController {
    private static final Logger logger = LoggerFactory.getLogger(UnionPaySeparateAccountController.class);

    @Autowired
    private UnionPaySeparateAccountService unionPaySeparateAccountService;

    @ApiOperation("根据流水划账")
    @PostMapping("/remitAccount")
    public R chargeAccordingToAmount(@RequestBody CreateRemitAccountRq rq) throws Exception {
        boolean status = unionPaySeparateAccountService.chargeAccordingToAmount(rq);
        return R.ok(status);
    }

    @ApiOperation("根据订单分账")
    @PostMapping("/create/separateAccount")
    public R createSeparateAccount(@RequestBody CreateSeparateAccountRq rq) throws Exception {
        boolean status = unionPaySeparateAccountService.createSeparateAccount(rq);
        return R.ok(status);
    }
}
